<!DOCTYPE html> 
<html> 
    <head> 
        <title>Create Article</title> 
        
        <link rel="stylesheet" type="text/css" href="addNews_style.css" />
        
        <link rel="stylesheet" type="text/css" href="tcal.css" />
        
		<script type="text/javascript" src="tcal.js"></script> 
	
        <script type="text/javascript"> 
        var fields = 1; 
            function add_fields() { 
                fields++; 
                var d = document.getElementById("content"); 
                var row = document.createElement("tr"); 
                row.innerHTML = "<td><label for='imgurl'>Image URL:</label></td><td><input style='width: 300px; height: 25px;" + 
                	" background-color: #FFFAD1; font-size: 16px;border: 1px solid gray;' type='text' id='imgurl' name='imgurl[]' />" +
                	"</td><tr><td><label for='imgcapt'>Image Caption:</label></td><td><input style='width: 300px; height: 25px; "+
                	"background-color: #FFFAD1; font-size: 16px; border: 1px solid gray;' type='text' id='imgcapt' name='imgcapt[]' />"+
                	"</td></tr>"; 
                d.appendChild(row) 
                } 
        </script> 
    </head> 
    <body>  
        <form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post"> 
        <table  id="content"> 
            <tr> 
                <td><label for="title">Article Title:</label></td>  
                <td><input class="input" type="text" id="title" name="title" /></td> 
            </tr> 
            <tr> 
                <td><label for="body">Article Body:</label></td> 
                <td><textarea id="body" name="body" rows="14"></textarea></td> 
            </tr> 
            <tr> 
                <td><label for="date">Date:</label></td> 
                <td><input type="text" name="date" class="tcal"/></td> 
            </tr> 
            <tr> 
                <td><label for="author">Author:</label></td> 
                <td><input class="input" type="text" id="author" name="author"/></td> 
            </tr> 
            <tr> 
                <td><label for="imgurl">Image URL:</label></td> 
                <td><input class="input" type="text" id="imgurl" name="imgurl[]" /></td> 
                <td><label for="imgcapt">Image Caption:</label></td> 
                <td><input class="input" type="text" id="imgcapt" name="imgcapt[]" /></td> 
            </tr> 
        </table> 
        <br /> 
                <input type="submit" value="Post" name="submit" id="submit" /> 
        </form>    
                <button id="more_fields" onclick="add_fields();"  name="add">Add Image</button> 
        <?php  
        	if(isset($_POST['submit'] )) { 
  		    	require_once ("dbconnection.php");
  		    	uploadArticle();
			} 
        ?>    
    </body> 
</html>